using UnityEngine;
using UnityEditor;
using Yoozoo.Gameplay.Liberty.StreetEvent;

[CustomEditor(typeof(StreetFightPropItemPoint))]
public class StreetFightPropItemPointEditor : Editor
{
    public override void OnInspectorGUI()
    {
        // 绘制默认检查器
        DrawDefaultInspector();

        // 强制转换为StreetFightPropItemPoint对象
        StreetFightPropItemPoint script = (StreetFightPropItemPoint)target;

        // 显示额外的信息
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("刷新状况", EditorStyles.boldLabel);

        if (GUILayout.Button("刷新点位状态"))
        {
            // 这里可以添加代码来刷新和显示点位的状态
            // 例如，重新获取点位信息，计算每个点位的当前状态等
        }

        // 显示每个点位的状态
        if (script.pointList != null)
        {
            for (int i = 0; i < script.pointList.Length; i++)
            {
                Transform point = script.pointList[i];
                long uid = script.createdMap.ContainsKey(i) ? script.createdMap[i].UID : -1;
                string status = uid != -1 ? $"UID: {uid}" : "未生成";
                EditorGUILayout.LabelField($"点位 {i + 1} ({point.name}): {status}");
            }
        }
        else
        {
            EditorGUILayout.HelpBox("点位列表为空", MessageType.Info);
        }
    }
}